//
//  HMBaseTableViewController.m
//  OC新浪微博
//
//  Created by wyman on 16/4/10.
//  Copyright © 2016年 wyman. All rights reserved.
//

#import "HMBaseTableViewController.h"
#import "HMVistorView.h"
#import "HMDiscoverViewController.h"
#import "HMHomeViewController.h"
#import "HMProfileViewController.h"
#import "HMMessageTableViewController.h"
#import "HMQauthViewController.h"
#import "HMUserAccountModel.h"
#import <SVProgressHUD.h>
@interface HMBaseTableViewController ()
//@property (nonatomic, strong) HMVistorView *vistorview;
@end

@implementation HMBaseTableViewController



-(void)loadView
{
    
    if ([HMUserAccountModel sharedInstance].userLogin) {
        [super loadView];
    }else{
        [self setupVistorView];
    }
    
    
}



-(void)setupVistorView
{
    HMVistorView *view = [[HMVistorView alloc]init];
    
    //设置图片隐藏
    view.mainView.hidden = YES;
    view.coverView.hidden = YES;
    view.regsitDidClick = ^(){
        
        [self registClick];
    
    };
    
    view.loginDidClick = ^(){
        
        [self loginClick];
        
    };
    self.view = view;
   
    //更换数据
    if ([self isKindOfClass:[HMHomeViewController class]]) {
        view.coverView.hidden = NO;

        view.mainView.hidden = NO;
        [view startRotate];

    }else if ([self isKindOfClass:[HMMessageTableViewController class]])
    {
    
        [view changgeImage:@"visitordiscover_image_message" lable: @"登录后，别人评论你的微博，发给你的消息，都会在这里收到通知"];
    }else if ([self isKindOfClass:[HMDiscoverViewController class]]){
        [view changgeImage:@"visitordiscover_image_message" lable: @"登录后，最新、最热微博尽在掌握，不再会与实事潮流擦肩而过"];
    
    }else if ([self isKindOfClass:[HMProfileViewController class]]){
    [view changgeImage:@"visitordiscover_image_profile" lable: @"登录后，你的微博、相册、个人资料会显示在这里，展示给别人"];
    
    }
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(registClick)];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"登录" style:UIBarButtonItemStylePlain target:self action:@selector(loginClick)];
    
    
}
-(void)registClick{
    NSLog(@"点击");


}
-(void)loginClick
{
    NSLog(@"点击");

    UIViewController *vc = [[HMQauthViewController alloc]init];
    NSLog(@"%@",vc);
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
    [self presentViewController:nav animated:YES completion:nil];
    
    

}

@end
